# selenium安装
# pip install selenium
import time

from selenium import webdriver
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
# 设置窗口大小，设置为1920*1080
options.add_argument("window-size=1920,1080")
# 去除"chrome正受到自动测试软件的控制"的提示
options.add_experimental_option("excludeSwitches", ["enable-automation"])
# 解决selenium无法访问https的问题
options.add_argument("--ignore-certificate-errors")
# 允许忽略localhost上的TLS/SSL错误
options.add_argument("--allow-insecure-localhost")
# 设置为无痕模式
options.add_argument("--incognito")
# 设置为无头模式
# options.add_argument("--headless")
# 解决卡顿
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")

service = webdriver.ChromeService(executable_path="./driver/chromedriver-119.exe")
driver = webdriver.Chrome(service=service, options=options)
# driver = webdriver.Chrome(ChromeDriverManager(url="http://chromedriver.storage.googleapis.com/index.html?path=",
# latest_release_url="http://chromedriver.storage.googleapis.com/LATEST_RELEASE").install(), options=options)
# 删除所有cookies
driver.delete_all_cookies()
# 设置为全屏模式
driver.maximize_window()

driver.get(url="https://caasyun.com/login")
driver.implicitly_wait(10)
# driver.find_element(By.ID, "username").send_keys("username")
# driver.find_element(By.ID, "password").send_keys("password")
# driver.find_element(By.TAG_NAME, "button").click()
time.sleep(3)
driver.quit()
